﻿@{
    ViewBag.Title = "PersonalAchievementList";
    Layout = "~/Views/Shared/_BasicLayout.cshtml";
}
<script type="text/javascript">
    $(function () {
        var rowData;
        var height = $("#divTotal").height();
        var master = $("#master").height();
        var content = parseFloat(height) - parseFloat(master) - 30;
        $("#tbList").css("height", content);
    });
</script>
<script type="text/javascript">
    $(function () {
        $("#tbList").datagrid({
            url: '/AttendenceManagement/getAttendenceManagementList',
            loadMsg: '数据加载中请稍后……',
            pagination: true,
            rownumbers: true,
            idField: "ID",
            lines: true,
            singleSelect: true,
            pageSize: 20,
            queryParams: com.serializeSearchArray("form1"),
            pageList: [20, 50, 100],
            striped: true,
            fitColumns: false,
            columns: [[
                  { field: 'ck', checkbox: true, width: 30 },
                  { field: 'ID', title: 'ID', width: 50, align: "center", hidden: true },
                  { field: 'classCode', title: 'classCode', width: 50, align: "center", hidden: true },
                  { field: 'className', title: '班级名称', sortable: true, width: 150, align: "center" },
                  { field: 'Year', title: '年度', sortable: true, width: 100, align: "center" },
                  {
                      field: 'TermTypeID', title: '学期', sortable: true, width: 100, align: "center",
                      formatter: function (value, row, index) {
                          return com.getArrayText(StaticCombo.Term, value);
                      }
                  },
                  {
                      field: 'TeachTypeID', title: '教学方式', sortable: true, width: 100, align: "center",
                      formatter: function (value, row, index) {
                          var TeachType = undefined;
                          com.ajax({
                              url: "/DataDic/GetDataDicItemName",
                              data: { DataDicItemID: value },
                              async: false,
                              success: function (data) {
                                  TeachType = data.DataDicItem;
                              }
                          });
                          return TeachType;
                      }
                  },
                  {
                      field: 'TeacherName', title: '主讲老师', sortable: true, width: 100, align: "center",
                      formatter: function (value, row, index) {
                          var Teachers = undefined;
                          com.ajax({
                              url: "/BukeManagement/getTeachers",
                              data: { classCode: row.classCode },
                              async: false,
                              success: function (data) {
                                  Teachers = data.msg;
                              }
                          });
                          return Teachers;
                      }
                  },
                  { field: 'classIndex', title: '课次', sortable: true, width: 100, align: "center" },
                  { field: 'classDate', title: '上课日期', sortable: true, width: 120, align: "center" },
                  { field: 'startTime', title: '上课开始时间', sortable: true, width: 120, align: "center" },
                  { field: 'endTime', title: '上课结束时间', sortable: true, width: 120, align: "center" },
                  {
                      field: 'IfDuty', title: '是否已考勤', sortable: true, width: 120, align: "center",
                      formatter: function (value, row, index) {
                          return com.getArrayText(StaticCombo.YesorNo, value);
                      }, styler: function (value, row, index) {
                          if (value == "" || value == null) {
                              return 'background-color:white;';
                          }
                          else {
                              if (value == "0") {
                                  return 'background-color:white;';
                              }
                              else {
                                  return 'background-color:green;';
                              }
                          }
                      }
                  },
                  { field: 'AttendancePerName', title: '考勤人', sortable: true, width: 100, align: "center" },
                  { field: 'AttendanceTime', title: '考勤时间', sortable: true, width: 120, align: "center" }
            ]], onDblClickRow: function (rowIndex, rowData) {
                top.wrapper.addTab("查看考勤明细", "/JW/AttendenceManagement/AttendenceManagementDetail?action=view&ID=" + rowData.ID);
            }
        });
    });
</script>
<script type="text/javascript">
    //查询
    function funcSearch() {
        var para = com.serializeSearchArray("form1");
        $("#tbList").datagrid("load", para);
    }
    //重置
    function funcReload() {
        $("#form1").form("reset");
        var para = com.serializeSearchArray("form1");
        $("#tbList").datagrid("load", para);
    }
    //添加本次课考勤记录
    function funcEdit() {
        var row = $('#tbList').datagrid('getSelected');
        if (row) {
            top.wrapper.addTab("添加本次课考勤记录", '/JW/AttendenceManagement/AttendenceManagementDetail?action=edit&ID=' + row.ID);
        }
        else {
            com.message("information", "请至少选中一行");
        }
    }
</script>
<div id="divTotal" style="height: 100%; width: 100%">
    <div style="margin:5px" id="master">
        <form id="form1">
            <input id="className" name="className" class="easyui-textbox" data-options="prompt:'班级名称'" data-cp="co" style="width:130px">
            <input id="Year" name="Year" class="easyui-textbox" data-options="prompt:'年度'" style="width:130px" data-cp="co">
            <input id="SchoolName" name="SchoolName" class="easyui-textbox" data-options="prompt:'所属校区名称'" style="width:130px" data-cp="co">
            <input id="classIndex" name="classIndex" class="easyui-textbox" data-options="prompt:'课次'" style="width:100px" data-cp="co">

            是否已考勤：<input class="easyui-combobox" id="IfDuty" name="IfDuty" value="0" data-cp="=" data-options="valuefield:'value',textfield:'text',data:StaticCombo.YesorNo,panelHeight:'auto',editable:false" style="width:120px" />
        </form>
    </div>
    <table id="tbList" title="课表考勤信息表" style="width: 100%"></table>
</div>
